package com.xh.jf_blog.common.exception;

import com.xh.jf_blog.common.util.R;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author PangJunjie
 * @Date 2024/1/26/026
 */
//@ControllerAdvice
//@ResponseBody
@RestControllerAdvice
public class AppExceptionHandler {

    @ExceptionHandler(RTException.class)
    public R handlerRTException(RTException e) {
        return R.error(e.getCode(), e.getMsg());
    }

    @ExceptionHandler(Exception.class)
    public R handlerException(Exception e) {
        return R.error(e.getMessage());
    }

}
